package cn.ekuma.epos.bean.util.sale;

import java.util.ArrayList;
import java.util.List;

import cn.ekuma.epos.bean.util.CustomerWarp;
import com.openbravo.bean.PaymentInfo;
import com.openbravo.bean.Tax;
import com.openbravo.bean.sales.Ticket;
import com.openbravo.bean.sales.TicketLine;
import com.openbravo.bean.shard.I_WarpEntity;

public class TicketWarp implements I_WarpEntity<Ticket>{
    Ticket t;
    
    public TicketWarp(Ticket ticket){
    	this.t=ticket;
    }
	
	public String getName(Object info) {
        return TicketHelper.getName(t,info);
    }

    public String getName() {
    	 return TicketHelper.getName(t);
    }

    public String printId() {
    	return TicketHelper.printId(t);
    }

    public String printDate() {
    	return TicketHelper.printDate(t);
    }

    public  String printUser() {
    	return TicketHelper.printUser(t);
    }

    public String printCustomer() {
    	return TicketHelper.printCustomer(t);
    }

    public String printArticlesCount() {
    	return TicketHelper.printArticlesCount(t);
    }

    public String printSubTotal() {
    	return TicketHelper.printDefSubTotal(t);
    }

    public String printPrefArticlesCount() {
    	return TicketHelper.printPrefArticlesCount(t);
    }

    public String printPrefSubTotal() {
    	return TicketHelper.printPrefSubTotal(t);
    }

    public String printTax() {
    	return TicketHelper.printTax(t);
    }

    public String printTotal() {
    	return TicketHelper.printTotal(t);
    }

    public  String printTotalPaid() {
    	return TicketHelper.printTotalPaid(t);
    }

    public String printPriceRate() {
    	return TicketHelper.printPriceRate(t);
    }

    public  String printDefSubTotal() {
    	return TicketHelper.printDefSubTotal(t);
    }

    public String printDefTax() {
    	return TicketHelper.printDefTax(t);
    }

    public String printDefTotal() {
    	return TicketHelper.printDefTotal(t);
    }
    
    public List getLines(){
    	List warpLine=new ArrayList();
    	for(TicketLine l:t.getLines())
    		warpLine.add(new TicketLineWarp(l));
    	return warpLine;
    }
    
    public TaxWarp getTaxLine(Tax tax) {
    	return new TaxWarp(TicketHelper.getTaxLine(t, tax));
    }
    
    public List getPayments() {
    	List warpLine=new ArrayList();
    	for(PaymentInfo p:t.getPayments())
    		warpLine.add(new PaymentWarp(p));
        return warpLine;
    }
    
    public CustomerWarp getCustomer(){
    	if(t.getCustomer()==null)
    		return null;
    	return new CustomerWarp(t.getCustomer());
    }
    
    public int getTicketType(){
    	return t.getTicketType();
    }

	@Override
	public Ticket getWarpBean() {
		return t;
	}
    
	public String printTotalScore(){
		return TicketHelper.printTotalScore(t);
	}
}
